<template>
	<view class="">
		<view class="wrap">
			<web-view v-if="processInstanceId" ref="wb" :update-title="false" :webview-styles="webviewStyles" :src="webViewUrl" ></web-view>
		</view>
	</view>
</template>

<script>
	import navbar from '@/components/navbar.vue'
	import configService from '@/config.js'
	import { mapGetters } from 'vuex'
	export default {
		components:{ navbar },
		data() {
			return {
				webviewStyles: {
					progress: {
						color: '#FF3333',
					}
				},
				processInstanceId:''
			}
		},
		computed:{
			...mapGetters(['token','refreshToken']),
			webViewUrl(){
				return configService.pcUrl+'/bpmnView?processInstanceId='+this.processInstanceId
			}
		},
		methods:{
			handleMessage(){
				this.curWebview = this.$scope.$getAppWebview().children()[0]
				const data = {
					refreshToken:this.refreshToken,
					token:this.token
				}
				this.curWebview.setStyle({scalable:true})
				this.curWebview.evalJS(`updateToken(${JSON.stringify(data)})`)
			}
		},
		onLoad(options) {
			const { processInstanceId } =this.$Route.query
			this.processInstanceId = processInstanceId
			// setTimeout(() => {
			// 	this.handleMessage()
			// },4000)
		}
	}
</script>
<style lang="scss" scoped>
	page {
		background-color: #ffffff;
		padding-left: 10px;
		padding-right: 10px;
	}
	.wrap{
		padding: 12px;
		.form-warp{
			width: 100%;
			height: calc(100vh - 100px);
		}
	}
</style>
